 package net.go176.backpack.config;
 
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.logging.Level;
 import net.go176.backpack.Backpack;
 import net.go176.backpack.core.DataManager;
 import net.go176.backpack.core.DataType;
 import org.bukkit.entity.Player;
 import org.bukkit.plugin.Plugin;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 public class ConfigManager
 {
   private Backpack p;
   private Config cfgWorldLinks;
   private Config cfgLogoutWorlds;
   public boolean multi_Vanilla;
   public boolean multi_Health;
   public boolean multi_Attributes;
   public boolean multi_Effects;
   public boolean multi_Inventory;
   public boolean multi_Experience;
   public boolean multi_FoodLevel;
   public boolean multi_Abilities;
   public boolean multi_EnderChest;
   public boolean multi_GameType;
   public boolean multi_Bukkit_ExtraData;
   public boolean multi_Baubles_Inventory;
   public boolean multi_Thaumcraft_Knowledge;
   public boolean multi_Aether_Accessories;
   public boolean ops_g_AllowBypass;
   public int ops_g_AutoSave_Interval;
   public boolean ops_g_AutoSave_LogInfo;
   public int ops_adv_UpdatePlayerWorldDelay;
   public int ops_adv_ResetStatusesInterval;
   private Map<String, Set<String>> worldLinks;
   
   public ConfigManager(Backpack plugin) {
     this.worldLinks = new LinkedHashMap<>(0); this.p = plugin; this.p.saveDefaultConfig(); this.cfgWorldLinks = new Config((Plugin)this.p, "worldlinks.yml");
     this.cfgWorldLinks.saveDefaultConfig();
     this.cfgLogoutWorlds = new Config((Plugin)this.p, "logoutworlds.yml");
     reloadConfigs(); } public void reloadConfigs() { try {
       this.p.saveDefaultConfig();
       this.p.reloadConfig();
       
       this.multi_Vanilla = this.p.getConfig().getBoolean("MultiPlayerdata.Vanilla.Enable", true);
       this.multi_Health = this.p.getConfig().getBoolean("MultiPlayerdata.Vanilla.Health", true);
       this.multi_Attributes = this.p.getConfig().getBoolean("MultiPlayerdata.Vanilla.Attributes", false);
       this.multi_Effects = this.p.getConfig().getBoolean("MultiPlayerdata.Vanilla.Effects", true);
       this.multi_Inventory = this.p.getConfig().getBoolean("MultiPlayerdata.Vanilla.Inventory", true);
       this.multi_Experience = this.p.getConfig().getBoolean("MultiPlayerdata.Vanilla.Experience", true);
       this.multi_FoodLevel = this.p.getConfig().getBoolean("MultiPlayerdata.Vanilla.FoodLevel", true);
       this.multi_Abilities = this.p.getConfig().getBoolean("MultiPlayerdata.Vanilla.Abilities", false);
       this.multi_EnderChest = this.p.getConfig().getBoolean("MultiPlayerdata.Vanilla.EnderChest", true);
       this.multi_GameType = this.p.getConfig().getBoolean("MultiPlayerdata.Vanilla.GameType", false);
       this.multi_Bukkit_ExtraData = this.p.getConfig().getBoolean("MultiPlayerdata.Vanilla.Bukkit_ExtraData", false);
       
       this.multi_Baubles_Inventory = this.p.getConfig().getBoolean("MultiPlayerdata.Baubles.Inventory", true);
       this.multi_Thaumcraft_Knowledge = this.p.getConfig().getBoolean("MultiPlayerdata.Thaumcraft.Knowledge", true);
       this.multi_Aether_Accessories = this.p.getConfig().getBoolean("MultiPlayerdata.Aether.Accessories", true);
       
       this.ops_g_AllowBypass = this.p.getConfig().getBoolean("Options.General.AllowBypass", true);
       this.ops_g_AutoSave_Interval = this.p.getConfig().getInt("Options.General.AutoSave.Interval", 3600);
       this.ops_g_AutoSave_LogInfo = this.p.getConfig().getBoolean("Options.General.AutoSave.LogInfo", true);
       if (this.ops_g_AutoSave_Interval < 0) {
         this.ops_g_AutoSave_Interval = 0;
       }
       this.ops_adv_UpdatePlayerWorldDelay = this.p.getConfig().getInt("Options.Advanced.UpdatePlayerWorldDelay", 0);
       this.ops_adv_ResetStatusesInterval = this.p.getConfig().getInt("Options.Advanced.ResetStatusesInterval", 6000);
       if (this.ops_adv_ResetStatusesInterval < 0)
         this.ops_adv_ResetStatusesInterval = 0; 
     } catch (Exception e) {
       logConfigLoadingError("config.yml", e);
     } 
     try {
       this.cfgWorldLinks.saveDefaultConfig();
       this.cfgWorldLinks.reloadConfig();
       
       this.worldLinks.clear();
       for (Map.Entry<String, Object> entry : (Iterable<Map.Entry<String, Object>>)this.cfgWorldLinks.getConfig().getValues(false).entrySet()) {
         String link = entry.getKey();
         if (link.equals("default"))
           continue; 
         Set<String> worlds = new LinkedHashSet<>();
         Object value = entry.getValue();
         if (value instanceof java.util.ArrayList) {
           for (Object world : value)
             worlds.add(String.valueOf(world)); 
         } else {
           worlds.add(String.valueOf(value));
         }  this.worldLinks.put(link, worlds);
       } 
     } catch (Exception e) {
       logConfigLoadingError(this.cfgWorldLinks.getFileName(), e);
     } 
     try {
       this.cfgLogoutWorlds.reloadConfig();
     } catch (Exception e) {
       logConfigLoadingError(this.cfgLogoutWorlds.getFileName(), e);
     }  }
 
   
   private void logConfigLoadingError(String name, Throwable t) {
     this.p.getLogger().log(Level.SEVERE, "Error loading configuration \"" + name + "\"", t);
   }
   
   public void applyAllData() {
     this.p.getDataManager().resetTimer();
   }
   
   public String getWorldLink(String worldName) {
     for (Map.Entry<String, Set<String>> entry : this.worldLinks.entrySet()) {
       String link = entry.getKey();
       Set<String> worlds = entry.getValue();
       if (worlds.contains(worldName))
         return link; 
     } 
     return "default";
   }
   
   public Map<String, Set<String>> getWorldLinks() {
     return new LinkedHashMap<>(this.worldLinks);
   }
   
   public String getLogoutWorld(String playerName) {
     return this.cfgLogoutWorlds.getConfig().getString(playerName);
   }
   
   public Set<String> getLogoutWorlds() {
     return this.cfgLogoutWorlds.getConfig().getKeys(false);
   }
   
   public void saveLogoutWorld(Player player) {
     this.cfgLogoutWorlds.getConfig().set(player.getName(), player.getWorld().getName());
     this.cfgLogoutWorlds.saveConfig();
   }
   
   public void saveAllLogoutWorlds() {
     for (DataManager.PlayerStatus status : this.p.getDataManager().getPlayerStatuses())
       this.cfgLogoutWorlds.getConfig().set(status.playerName, status.getWorld()); 
     this.cfgLogoutWorlds.saveConfig();
   }
   
   public boolean isForcedModeEnabled(DataType type) {
     return this.p.getConfig().getBoolean("Options.Advanced.ForcedMode." + type.name + ".Enable", false);
   }
   
   public String getForcedMode(DataType type) {
     return this.p.getConfig().getString("Options.Advanced.ForcedMode." + type.name + ".Version", "mcp9_0");
   }
 }


/* Location:              D:\User\Xuan\Downloads\MyBackpack1.2.5.jar!\net\saralab\mybackpack\config\ConfigManager.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.1.3
 */